$(document).ready(function(){

  /*menu*/    
  $('ul#loggedout-nav li a.notLinked').replaceWith($('ul#loggedout-nav li a.notLinked').text());
  /*menu*/
         
  //$('#pagebar a').click(function () { $("#home").fadeIn("slow"); });
  
  /* controllo form*/
  $('input.required').blur(function(){validateForm();});
  $('.control').click(function(){validateForm();});
  /* controllo form*/
  
  /* news */
  $('#submitNews').click(function(){addNews();});
  $('.deletebtnews').click(function(){delNews($(this).attr("id"));});
  /* news */
  
  /* users */
  $('#submitUser').click(function(){addUser();});
 
  $('.deletebtnusers').click(function(){delUser($(this).attr("id"));});  
  /* users */
  
   /* gift */
  //$('#submitGift').click(function(){addGift();});
  $('.deletebtngift').click(function(){delGift($(this).attr("id"));});  
  /* gift */
  
 
  /* azioni gestione service */
  $('#submitService').click(function(){addService();});
  $('.deletebtnservices').click(function(){delService($(this).attr("id"));});  
  $('#editService').click(function(){editService();}); 
  /* azioni gestione service */
  
  /* services */
  $('.nav li').mouseover(function(){ $(this).children('ul li').css({"left":"auto"}); });
  $('.nav li').mouseout(function(){ $(this).children('ul li').css({"left":"-999em"}); });
  /* services */
  
  /*signup*/
  $('#pick-username').blur(function() { checkUsername($('#pick-username').val()) });
  $('#user-email').blur(function() { checkMail($(this).val())  });
  $('#repeat-password').blur(function() { matchPassword($('#choose-password').val()) });
  /*signup*/
  
  /* user friend*/
	 $('.frienddeletebtn').click(function(){delUserFriend($(this).attr("id"));}); 
	 $('.friendaddbtn').click(function(){addUserFriend($(this).attr("id"));}); 
	/* user friend*/
  
	  /* language*/
	 $('.firstlanguage').click(function(){changeLang($(this).attr("id"));}); 
	 $('.secondlanguage').click(function(){changeLang($(this).attr("id"));}); 
	/* language*/
  
  /* user gift */
 // $('#submitUserGift').click(function(){if($('#titleGift').val().length > 0){addUserGift();} });
  $('.savegiftideas').click(function(){modUserGift($(this).attr("id"));}); 
  $('.usrdeletebtn').click(function(){delUserGift($(this).attr("id") );}); 
  //$('.listn').click(function(){addGiftListJ2ee();});
  //$('#AddList').click(function(){addListGift();});
  $('#ModList').click(function(){editListGift();}); 
  $('#addGiftIdea').click(function(){addGiftIdea();});
  $('.addGiftIdeaToList').click(function(){addGiftIdeaToList($(this).attr("id"));}); 
    //hide the all of the element with class msg_body
	$(".msg_body").hide();
	 //toggle the componenet with class msg_body
	$(".msg_head").click(function(){$(this).next(".msg_body").slideToggle(600);	});
	 //hide the all of the element with class msg_body
	$(".managetitle").hide();
	 //toggle the componenet with class msg_body
	$(".listname").click(function(){
		$(this).next(".managetitle").slideToggle(600);
		$(this).next(".listname").slideToggle(600);
	});
    $("div.msg_list div:even").addClass("even");
    $("div.msg_list div:odd").addClass("odd");
  /* user gift */

	
});
